package cn.edu.xmist.springmvcconcurrentdemo.controller;

import cn.edu.xmist.springmvcconcurrentdemo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * @author zhongjinbin 2021/4/18
 * @since 0.0.1
 */
@Controller
@RequestMapping("/order")
public class OrderController {

    @Autowired
    OrderService orderService;

    @RequestMapping("getOrderInfo")
    /**
     * @ResponseBody注解代表springmvc自动把对象转换为json
     */
    @ResponseBody
    public Map<String, Object> getOrderInfo(@RequestParam(required = false) String orderCode) throws ExecutionException, InterruptedException {
        return orderService.queryOrderInfo(orderCode);
    }
}
